package com.example.administrator.five_in_a_row;

import android.app.Activity;
import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import static com.example.administrator.five_in_a_row.R.id.btn_am_add;
import static com.example.administrator.five_in_a_row.R.id.default_activity_button;

public class MainActivity extends Activity {
    private Button btnCreate;
    private Button  btnadd;
    private MyService.MyBinder myBinder = null;
    private Handler handler = new Handler(){

        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            switch (msg.what){

                case 0x123:


                    break;
                default:
                    break;
            }
        }
    };
    private ServiceConnection connection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            myBinder = (MyService.MyBinder) service;
            myBinder.sendHandler(handler);


        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
        myBinder =null;
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btnCreate = (Button) findViewById(R.id.btn_am_create);
        btnadd = (Button) findViewById(R.id.btn_am_add);
        btnCreate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        btnadd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
    }

}
